import 'package:flutter/material.dart';
import 'package:flutter_plant_ui/model/plants_model.dart';
import 'package:flutter_plant_ui/screen/detail/details_screen.dart';

import 'recomend_plant_cart.dart';

class RecomendsPlants extends StatelessWidget {
  const RecomendsPlants({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      physics: BouncingScrollPhysics(),
      scrollDirection: Axis.horizontal,
      child: Row(
        children: plants.map((plant) {
          return RecomendPlantCard(
            image: plant.image,
            title: plant.title,
            country: plant.country,
            price: plant.price,
            press: () {
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => DetailsScreen(),
                ),
              );
            },
          );
        }).toList(),
      ),
    );
    // return ListView.builder(
    //     itemCount: plants.length,
    //     scrollDirection: Axis.horizontal,
    //     itemBuilder: (context, index) {
    //       Plant plant = plants[index];
    //       return RecomendPlantCard(
    //         image: plant.image,
    //         title: plant.title,
    //         country: plant.country,
    //         price: plant.price,
    //         press: () {
    //           // Navigator.push(
    //           //   context,
    //           //   MaterialPageRoute(
    //           //     builder: (context) => DetailsScreen(),
    //           //   ),
    //           // );
    //         },
    //       );
    //     });
  }
}
